﻿<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta name="keywords" content="{:getWebConfig('web_site_keyword')}" />
		<meta name="description" content="{:getWebConfig('web_site_description')}">
		<title>{:getWebConfig('web_site_title')}</title>
		<!-- <link rel="stylesheet" href="__CSS__/bootstrap.css" />
		<link rel="stylesheet" href="__CSS__/style.css" />
		<link rel="stylesheet" href="__CSS__/layui.css" />
		<link rel="stylesheet" href="__CSS__/zrstyle.css" /> -->
		<script type="text/javascript" src="__JS__/jquery-2.1.0.js"></script>
		<script type="text/javascript" src="__JS__/jquery.cookie.js"></script>
		<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
		<script type="text/javascript" src="__JS__/layer/layer.js"></script>

		    <!-- 自定义样式 -->
    	<link rel="stylesheet" href="__CSS__/styleOne.css" />
    	<link rel="stylesheet" href="__CSS__/styleTwo.css" />
    	<link rel="stylesheet" href="__CSS__/changeLayui.css" />
		<style>
			* {
				-webkit-box-sizing: border-box;
				-moz-box-sizing: border-box;
				box-sizing: border-box;
			}
			html,body{
				background: #FFFFFF;
			}
			.layer-anim{
				width:160px
			}
			.psw>input{
				height: 50px;
				line-height: 50px;
				width: 85%;
				border: 1px solid #3f81a5;
				text-indent: 5px;
			}
			.modal-dialog {
				width: 300px;
				text-align: center;
				margin: 320px auto;
			}
			.modal-body p{
				line-height: 25px;
			}
			.a_box{
				width:100%;
				margin-top:10px;
				display: flex;
				justify-items: center;
				align-items: center;
			}
			.a_box a{
				color:#3f81a5;
				margin: 0px auto;
			}
			.a_box>a:hover{
				color:#3f81a5;
				text-decoration: underline;
			}
			.fl {
				float: left;
			}
			.fr {
				float: right;
			}
			.pointer {
				cursor: pointer;
			}
			.a_box {
				width: 100%;
				margin-top: 30px;
				display: flex;
				justify-items: center;
				align-items: center;
			}
			.a_box a {
				color: #3f81a5;
				margin: 0px auto;
			}

		</style>
	</head>

	<body>
		<!--<div class="loginBox">
			<div class="loginCenter">
				<div class="imglogo"><img src="__IMG__/logoLogin.png" alt=""></div>
				<div class="lineOne">
					<div class="imgIconName"><img src="__IMG__/icon_user.png" alt=""></div>
					<div class="layui-input-block loginInput">
      					<input type="text" name="account" required  lay-verify="required" placeholder="请输入账号" autocomplete="off" class="layui-input">
    				</div>
				</div>
				<div class="lineOne">
					<div class="imgIconName"><img src="__IMG__/icon_pswd.png" alt=""></div>
					<div class="layui-input-block loginInput">
      					<input type="password" name="password" required  lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
    				</div>
				</div>
				<div class="lineOne doubleMar">
					<div class="imgIconName "></div>
					<div class="loginInput">
      					<div class="chooseDoublebox">
      						<div class="checkinput"> <input type="checkbox" name="free_board" value="1">记住密码</div>
      						<div class="coline" onclick="relationFun()">联系管理员</div>
      					</div>
    				</div>
				</div>
				<div class="loginbtnBox">
					<button class="loginbtnc" onclick="loginFun()">登录</button>
				</div>
			</div>
		</div>-->
		<div class="signinwrap">
			<div class="modelbg">

				<div class="signin">
					<div>
						<div class="logo">
							<!--<img src="__IMG__/logo.png" />-->
						</div>
						<h3>业绩管理系统</h3>
					</div>
					<div class="user">
						<span class="fl usericon"></span>
						<input class="fl" type="text" name="account" placeholder="请输入账号"/>
					</div>
					<div class="psw">
						<span class="fl pswicon"></span>
						<input class="fl" type="password" name="password" placeholder="请输入密码"/>
					</div>
					<!--<div class="code">
						<input type="text" name="code" id="code"/>
						<img id="thiscode" src="{:captcha_src()}" onclick="codes(this)"/>
					</div>-->
					<button class="signinbtn" onclick="loginFun()">登录</button>
					<div class="signinbot">
						<!--<input class="fl" type="checkbox" value="1" name="free_board"/>
						<p class="fl">三天内自动登录</p>-->
						<!--<a class="fr pointer" onclick="relationFun()">联系管理员</a>-->
					</div>
				</div>
			</div>
		</div>
	</body>

</html>

<script>
		//联系管理员
	 function relationFun(){
			var html = '';
			html +='<div class="contact">'
			html +='<div class="linkman">管理员: 小周</div>';
			html +='<div class="telephone">电话:1360000000</div>';
			html +='</div>'

		 parent.layer.open({
			title:'联系管理员',
			type: 1,
			area: ['300px', '300px'], //宽高
			shadeClose: true, //点击遮罩关闭
			content: html,
			success: function(layero, index){

			  }
		});
	}

	$("body").keydown(function() {
		if(event.keyCode == "13") {
			loginFun();
		}
	});

	function loginFun() {
		var account = $('input[name="account"]').val();
		var password = $('input[name="password"]').val();
		if($.trim(account) == '') {
			layer.msg('请填写登录帐号', {
				icon: 5,
				time: 2000
			});
			return false;
		}
		if($.trim(password) == '') {
			layer.msg('请填写登录密码', {
				icon: 5,
				time: 2000
			});
			return false;
		}
		var free_board = $('input:checkbox[name=free_board]:checked').val();
		var index = layer.load(1, {
			shade: [0.1,'#fff'] //0.1透明度的白色背景
		});
		var data = {};
		data.account = $.trim(account);
		data.password = $.trim(password);
		data = JSON.stringify(data);
		$.post("{:config('api')}/Achievement/Login/login",data,function (flag) {
			if (flag.code < 0){
				layer.msg(flag.message, {
					time: 2000
				});
				layer.close(index);
				return false;
			}
			$.post("{:url('Login/dolog')}",{token:flag.data.token},function (res) {
				layer.close(index);
				layer.msg(flag.message, {
					time: 2000
				});
				if (flag.code < 0){
					layer.msg('页面异常', {
						time: 2000
					});
					return false;
				}
				$.cookie('token', flag.data.token, { expires: 1,path: '/' });
				console.log(flag.data.company_id)
				$.cookie('company_id', flag.data.company_id, { expires: 1,path: '/' });
				var url = "{:url('Index/index')}";
				ade(url, flag.message);
			});
		})
	}

	function ade(url, msg) {
		layer.msg(msg, {
			icon: 6,
			time: 2000
		}, function() {
			window.location.href = url;
		});
	}

	function codes(obj) {
		$(obj).attr("src", "{:captcha_src()}");
	}
</script>
